package com.sg.service.biz.bff.impl;

import com.sg.common.exception.Assert;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.bff.req.*;
import com.sg.dto.biz.bff.res.*;
import com.sg.service.biz.bff.PasswordService;
import com.sg.service.biz.bff.nb.NbPassword;
import com.wicket.okrbff.common.exception.BizException;
import com.wicket.okrframework.integration.*;
import com.wicket.okrframework.integration.dto.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class PasswordServiceImpl implements PasswordService {

    @Resource
    com.sg.service.biz.framework.CaptchaService fwBaseCaptchaClient;
    @Resource
    NbPassword nbPassword;
    @Resource
    com.sg.service.biz.framework.UserService fwBaseUserClient;
    @Resource
    com.sg.service.biz.framework.PasswordService fwBasePasswordClient;
    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.component.MessageService fwCompMessageClient;
    @Resource
    com.sg.service.biz.framework.BaseService fwBaseBaseClient;

    @Resource
    com.sg.service.biz.framework.MemberService fwBaseMemberClient;
    @Resource
    com.sg.service.biz.app.MessageService fwAppMessageClient;

    /**
     * B1-2原密码修改密码[1157]
     * gen by moon at 8/10/2022, 3:33:10 AM
     */
    @Trace(operationName = "B1-2原密码修改密码")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffUpdateChangePasswordRespDto updateChangePassword(BffUpdateChangePasswordReqDto reqDto) {


        //步骤0: D1-2查询个人账号详情 - queryUserDetail
        QueryUserDetailRespDto queryUserDetailRespDto = null;
        QueryUserDetailReqDto queryUserDetailReqDto = new QueryUserDetailReqDto();
        queryUserDetailReqDto.setUserId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecUserId());//CURRENT_USERID//sourceId:30212_1
        if (reqDto != null) {
            queryUserDetailReqDto.setPassword(reqDto.getPassword());//sourceId:30255_1
        }

        /*查询原密码，与入参的原密码比对[1032]   */
        Assert.isNull(queryUserDetailReqDto.getUserId(), "B1-2原密码修改密码-查询原密码，与入参的原密码比对-个人账号不能为空", false);
        Assert.isNull(queryUserDetailReqDto.getPassword(), "B1-2原密码修改密码-查询原密码，与入参的原密码比对-密码不能为空", false);
        queryUserDetailRespDto = fwBaseUserClient.queryUserDetail(queryUserDetailReqDto).getData();


//步骤1: D1-2修改密码 - updateChangePassword
        UpdateChangePasswordRespDto updateChangePasswordRespDto = null;
        UpdateChangePasswordReqDto updateChangePasswordReqDto = new UpdateChangePasswordReqDto();
        updateChangePasswordReqDto.setUserId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecUserId());//CURRENT_USERID//sourceId:27013_1
        if (reqDto != null) {
            updateChangePasswordReqDto.setPassword(reqDto.getNewPassword());//sourceId:54437_1
        }

        /*D1-2修改密码[1158]   */
        Assert.isNull(updateChangePasswordReqDto.getUserId(), "B1-2原密码修改密码-D1-2修改密码-个人账号不能为空", false);
        updateChangePasswordRespDto = fwBasePasswordClient.updateChangePassword(updateChangePasswordReqDto).getData();


        BffUpdateChangePasswordRespDto retData = new BffUpdateChangePasswordRespDto();


        return retData;
    }

    /**
     * B1-2验证码修改密码[1160]
     * gen by moon at 8/10/2022, 3:33:11 AM
     */
    @Trace(operationName = "B1-2验证码修改密码")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffUpdateCaptchaChangePasswordRespDto updateCaptchaChangePassword(BffUpdateCaptchaChangePasswordReqDto reqDto) {


        //virtualUsage D1-检测验证码是否有效（特殊方法）  2277
        //ModelCode: checkCaptchaValid
        CheckCaptchaValidRespDto checkCaptchaValidRes = null;
        CheckCaptchaValidReqDto checkCaptchaValidReq = new CheckCaptchaValidReqDto();
        if (reqDto != null) {
            checkCaptchaValidReq.setPhone(reqDto.getPhone());//sourceId:60042_1_2277
            checkCaptchaValidReq.setVerificationCode(reqDto.getVerificationCode());//sourceId:60043_1_2277
        }

        /*D1-检测验证码是否有效（特殊方法）[1185]  用于检测用户前端录入验证码是否有效 */

        checkCaptchaValidRes = nbPassword.checkCaptchaValid(checkCaptchaValidReq);


        if ((checkCaptchaValidRes != null && checkCaptchaValidRes.getIsInvalid() != null && checkCaptchaValidRes.getIsInvalid().equals("TRUE"))) {
            //if(D1-检测验证码是否有效（特殊方法）.是否有效 等于 是)  2278

            UpdateChangePasswordRespDto updateChangePasswordRespDto = null;
            UpdateChangePasswordReqDto updateChangePasswordReqDto = new UpdateChangePasswordReqDto();
            updateChangePasswordReqDto.setUserId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecUserId());//CURRENT_USERID//sourceId:59705_1_2279
            if (reqDto != null) {
                updateChangePasswordReqDto.setPassword(reqDto.getPassword());//sourceId:54402_1_2279
            }

            /*D1-2修改密码[1158]   */
            Assert.isNull(updateChangePasswordReqDto.getUserId(), "B1-2验证码修改密码-D1-2修改密码-个人账号不能为空", false);
            updateChangePasswordRespDto = fwBasePasswordClient.updateChangePassword(updateChangePasswordReqDto).getData();


//processBranchName:正常结束 ,processBranchId:2280

        }
        BffUpdateCaptchaChangePasswordRespDto retData = new BffUpdateCaptchaChangePasswordRespDto();


        return retData;
    }

    /**
     * B1-2忘记密码新密码[484]
     * gen by moon at 8/10/2022, 3:29:30 AM
     */
    @Trace(operationName = "B1-2忘记密码新密码")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffUpdateSetNewPasswordRespDto updateSetNewPassword(BffUpdateSetNewPasswordReqDto reqDto) {


        //步骤0: D1-2修改密码 - updateChangePassword
        UpdateChangePasswordRespDto updateChangePasswordRespDto = null;
        UpdateChangePasswordReqDto updateChangePasswordReqDto = new UpdateChangePasswordReqDto();
        updateChangePasswordReqDto.setUserId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecUserId());//CURRENT_USERID//sourceId:25181_1
        if (reqDto != null) {
            updateChangePasswordReqDto.setPassword(reqDto.getPassword());//sourceId:54400_1
        }

        /*D1-2修改密码[1158]   */
        Assert.isNull(updateChangePasswordReqDto.getUserId(), "B1-2忘记密码新密码-D1-2修改密码-个人账号不能为空", false);
        updateChangePasswordRespDto = fwBasePasswordClient.updateChangePassword(updateChangePasswordReqDto).getData();


        BffUpdateSetNewPasswordRespDto retData = new BffUpdateSetNewPasswordRespDto();


        return retData;
    }

    /**
     * B1-2修改忘记密码[484]
     * gen by moon at 2/5/2024, 1:30:25 PM
     */
    @Trace(operationName = "B1-2修改忘记密码")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffUpdateForgotPasswordRespDto updateForgotPassword(BffUpdateForgotPasswordReqDto reqDto) {


        com.wicket.okrapp.integration.dto.ImplementPushCacheSendMessageChannelComRespDto implementPushCacheSendMessageChannelComRespDto_1 = null;
//virtualUsage D1-2找回密码  41941
        FindPasswordRespDto findPasswordRespDto = null;
        FindPasswordReqDto findPasswordReqDto = new FindPasswordReqDto();
        if (reqDto != null) {
            findPasswordReqDto.setUserName(reqDto.getUserName());//SimpleFieldAssign//sourceId:211558_1_41941
            findPasswordReqDto.setRoleMemberCode(reqDto.getRoleMemberCode());//SimpleFieldAssign//sourceId:211559_1_41941
            findPasswordReqDto.setPhone(reqDto.getPhone());//SimpleFieldAssign//sourceId:211560_1_41941
            findPasswordReqDto.setMyPwdAnswer(reqDto.getMyPwdAnswer());//SimpleFieldAssign//sourceId:211562_1_41941
            findPasswordReqDto.setPassword(reqDto.getPassword());//SimpleFieldAssign//sourceId:211561_1_41941
            findPasswordReqDto.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:980426_1_41941
        }

        /*D1-2找回密码[4009]   */
        Assert.isNull(findPasswordReqDto.getMyPwdAnswer(), "B1-2修改忘记密码-D1-2找回密码-密保答案不能为空", false);
        Assert.isNull(findPasswordReqDto.getPassword(), "B1-2修改忘记密码-D1-2找回密码-密码不能为空", false);
        Assert.isNull(findPasswordReqDto.getSpaceId(), "B1-2修改忘记密码-D1-2找回密码-创建于空间ID不能为空", false);
        findPasswordRespDto = fwBaseUserClient.findPassword(findPasswordReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//virtualUsage D1-2查询当前租户联盟应用配置的发送人成员ID  41942
        QueryAppDetailComRespDto queryAppDetailComRespDto = null;
        if (findPasswordRespDto != null) {
            QueryAppDetailComReqDto queryAppDetailComReqDto = new QueryAppDetailComReqDto();
            if (findPasswordRespDto != null) {
                queryAppDetailComReqDto.setUniqueSpaceId(findPasswordRespDto.getSpaceId());//SimpleFieldAssign//sourceId:952451_1_41942
            }

            /*D1-2查询当前租户联盟应用配置的发送人成员ID[3268]   */
            Assert.isNull(queryAppDetailComReqDto.getUniqueSpaceId(), "B1-2修改忘记密码-D1-2查询当前租户联盟应用配置的发送人成员ID-管理的空间ID不能为空", false);
            queryAppDetailComRespDto = fwBaseBaseClient.queryAppDetailCom(queryAppDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
            Assert.isTrue(queryAppDetailComRespDto == null || queryAppDetailComRespDto.getAppId() == null, "找不到数据，系统异常", false);


        }
        if ((queryAppDetailComRespDto != null && queryAppDetailComRespDto.getSenderMemberId() != null)) {
            //if(D1-2查询当前租户联盟应用配置的发送人成员ID.配置消息发送人成员ID 值不等于空 )  41943

            QueryMemberProfileDetailComRespDto queryMemberProfileDetailComRespDto = null;
            if (queryAppDetailComRespDto != null) {
                QueryMemberProfileDetailComReqDto queryMemberProfileDetailComReqDto = new QueryMemberProfileDetailComReqDto();
                if (queryAppDetailComRespDto != null) {
                    queryMemberProfileDetailComReqDto.setOriginalRoleMemberId(queryAppDetailComRespDto.getSenderMemberId());//SimpleFieldAssign//sourceId:972406_1_41945
                }
                if (reqDto != null) {
                    queryMemberProfileDetailComReqDto.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:1038856_1_41945
                }

                /*D1查询成员个人资料详情(公共)[6778]   */
                Assert.isNull(queryMemberProfileDetailComReqDto.getSpaceId(), "B1-2修改忘记密码-D1查询成员个人资料详情(公共)-创建于空间ID不能为空", false);
                queryMemberProfileDetailComRespDto = fwBaseMemberClient.queryMemberProfileDetailCom(queryMemberProfileDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            }
            com.wicket.okrapp.integration.dto.ImplementPushCacheSendMessageChannelComRespDto implementPushCacheSendMessageChannelComRespDto = null;
            if (queryMemberProfileDetailComRespDto != null && queryAppDetailComRespDto != null && findPasswordRespDto != null) {
                com.wicket.okrapp.integration.dto.ImplementPushCacheSendMessageChannelComReqDto implementPushCacheSendMessageChannelComReqDto = new com.wicket.okrapp.integration.dto.ImplementPushCacheSendMessageChannelComReqDto();
                implementPushCacheSendMessageChannelComReqDto.setUseChannelMethod("ISHAVE_MEMBER_CHANNEL");//sourceId:1521414_1_60631
                implementPushCacheSendMessageChannelComReqDto.setMessageTemplateCode("FORGOT_PWD_RESET_NOTICE");//CUSTOM_CONVENTION//sourceId:1521415_1_60631
                implementPushCacheSendMessageChannelComReqDto.setMessageLocationTypeCode("INTELLIGENT_CUSTOMER_SERVICE");//CUSTOM_CONVENTION//sourceId:1521416_1_60631
                implementPushCacheSendMessageChannelComReqDto.setMessagePromptType("NUMBER_TYPE");//sourceId:1521417_1_60631
                implementPushCacheSendMessageChannelComReqDto.setPlatformReplace("FALSE");//sourceId:1521418_1_60631
                implementPushCacheSendMessageChannelComReqDto.setMsgChannelClassCode("INTELLIGENT_CUSTOMER_SERVICE");//sourceId:1521420_1_60631
                implementPushCacheSendMessageChannelComReqDto.setChannelTypeCode("MESSAGE_ASSISTANT");//sourceId:1521421_1_60631
                implementPushCacheSendMessageChannelComReqDto.setNewTableTypeCode("OMS_FRAMEWORK_ORIGINAL_ROLE_MEMBER");//sourceId:1521423_1_60631
                implementPushCacheSendMessageChannelComReqDto.setMessageImportantLevel(Long.valueOf(3));//CUSTOM_CONVENTION//sourceId:1521428_1_60631
                implementPushCacheSendMessageChannelComReqDto.setConTableTypeCode("OMS_FRAMEWORK_USERS");//sourceId:1521429_1_60631
                implementPushCacheSendMessageChannelComReqDto.setHandleType("NO_NEED_HANDLING");//sourceId:1521440_1_60631
                implementPushCacheSendMessageChannelComReqDto.setBorcScene("TOB_SCENE");//sourceId:1521443_1_60631
                implementPushCacheSendMessageChannelComReqDto.setMessageRole("assistant");//sourceId:1521444_1_60631
                implementPushCacheSendMessageChannelComReqDto.setIsAssistant("TRUE");//sourceId:1521445_1_60631
                implementPushCacheSendMessageChannelComReqDto.setComNumField(Long.valueOf(1));//CUSTOM_CONVENTION//sourceId:1521461_1_60631
                implementPushCacheSendMessageChannelComReqDto.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1521462_1_60631
                if (queryMemberProfileDetailComRespDto != null) {
                    implementPushCacheSendMessageChannelComReqDto.setChannelLogo(queryMemberProfileDetailComRespDto.getUserFace());//SimpleFieldAssign//sourceId:1521419_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setChannelName(queryMemberProfileDetailComRespDto.getIdCardName());//SimpleFieldAssign//sourceId:1521422_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setChannelSpaceId(queryMemberProfileDetailComRespDto.getSpaceId());//SimpleFieldAssign//sourceId:1521426_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setChannelAppId(queryMemberProfileDetailComRespDto.getAppId());//SimpleFieldAssign//sourceId:1521427_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setSenderUserId(queryMemberProfileDetailComRespDto.getUserId());//SimpleFieldAssign//sourceId:1521450_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setSenderProfilePictureAddress(queryMemberProfileDetailComRespDto.getUserFace());//SimpleFieldAssign//sourceId:1521451_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setNameOfSender(queryMemberProfileDetailComRespDto.getIdCardName());//SimpleFieldAssign//sourceId:1521452_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setSenderSpaceId(queryMemberProfileDetailComRespDto.getSpaceId());//SimpleFieldAssign//sourceId:1521453_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setSenderAppId(queryMemberProfileDetailComRespDto.getAppId());//SimpleFieldAssign//sourceId:1521454_1_60631
                }
                if (queryAppDetailComRespDto != null) {
                    implementPushCacheSendMessageChannelComReqDto.setNewEntityId(queryAppDetailComRespDto.getSenderMemberId());//SimpleFieldAssign//sourceId:1521424_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setSenderOriginalRoleMemberId(queryAppDetailComRespDto.getSenderMemberId());//SimpleFieldAssign//sourceId:1521449_1_60631
                }
                if (findPasswordRespDto != null) {
                    implementPushCacheSendMessageChannelComReqDto.setConEntityId(findPasswordRespDto.getUserId());//SimpleFieldAssign//sourceId:1521430_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setObjectName(findPasswordRespDto.getObjectName());//SimpleFieldAssign//sourceId:1521437_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setNewMessage(findPasswordRespDto.getObjectName());//SimpleFieldAssign//sourceId:1521438_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setReceiveOriginalRoleMemberId(findPasswordRespDto.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:1521455_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setReceiveUserId(findPasswordRespDto.getUserId());//SimpleFieldAssign//sourceId:1521456_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setReceiveProfilePictureAddress(findPasswordRespDto.getUserFace());//SimpleFieldAssign//sourceId:1521457_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setNameOfReceive(findPasswordRespDto.getIdCardName());//SimpleFieldAssign//sourceId:1521458_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setReceiveSpaceId(findPasswordRespDto.getSpaceId());//SimpleFieldAssign//sourceId:1521459_1_60631
                    implementPushCacheSendMessageChannelComReqDto.setReceiveAppId(findPasswordRespDto.getAppId());//SimpleFieldAssign//sourceId:1521460_1_60631
                }

                /*D3执行推缓存发送消息到通道(公共)[8428]   */
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getUseChannelMethod(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-使用通道方式不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getMessageTemplateCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息模板标识不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getMessageLocationTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息位置标识不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getMessagePromptType(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息提示类型不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getPlatformReplace(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-是否平台代操作不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getMsgChannelClassCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息使用通道类别不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getChannelTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道类型编码不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getChannelLogo(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道缩略图地址不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getChannelName(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道名称不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getNewTableTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属主体内容类型编码不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getNewEntityId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属主体内容ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getChannelSpaceId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属空间ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getChannelAppId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属联盟应用ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getMessageImportantLevel(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息重要紧急度层级不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getConTableTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-内容表编码不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getConEntityId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-内容表主键ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getObjectName(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-对象名称不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getNewMessage(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-最新消息文本不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getHandleType(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-处理类型不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getBorcScene(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-toB或toC场景不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getMessageRole(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方角色不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getIsAssistant(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方是否助手不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getSenderOriginalRoleMemberId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方身份人员ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getSenderUserId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方账号ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getSenderProfilePictureAddress(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方头像地址不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getNameOfSender(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方姓名不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getSenderSpaceId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方空间ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getSenderAppId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方联盟应用ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getReceiveOriginalRoleMemberId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方身份人员ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getReceiveUserId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方账号ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getReceiveProfilePictureAddress(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方头像地址不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getNameOfReceive(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方姓名不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getReceiveSpaceId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方空间ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getReceiveAppId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方联盟应用ID不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getComNumField(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通用数值字段（整数型）不能为空", false);
                Assert.isNull(implementPushCacheSendMessageChannelComReqDto.getOperateTime(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-操作时间不能为空", false);
                implementPushCacheSendMessageChannelComRespDto = fwAppMessageClient.implementPushCacheSendMessageChannelCom(implementPushCacheSendMessageChannelComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


                implementPushCacheSendMessageChannelComRespDto_1 = implementPushCacheSendMessageChannelComRespDto;
            }
        } else if ((queryAppDetailComRespDto != null && queryAppDetailComRespDto.getSenderMemberId() == null)) {
            //elseif(D1-2查询当前租户联盟应用配置的发送人成员ID.配置消息发送人成员ID 值等于空 )  41944

            QueryAppDetailComRespDto queryAppDetailComRespDto_2 = null;
            if (findPasswordRespDto != null) {
                QueryAppDetailComReqDto queryAppDetailComReqDto_1 = new QueryAppDetailComReqDto();
                queryAppDetailComReqDto_1.setPlatformType("TRUE");//sourceId:952443_1_41947
                if (findPasswordRespDto != null) {
                    queryAppDetailComReqDto_1.setAppId(findPasswordRespDto.getAppId());//SimpleFieldAssign//sourceId:949793_1_41947
                }

                /*D1-2查询平台联盟应用配置的发送人成员ID[3268]   */
                Assert.isNull(queryAppDetailComReqDto_1.getAppId(), "B1-2修改忘记密码-D1-2查询平台联盟应用配置的发送人成员ID-应用ID不能为空", false);
                Assert.isNull(queryAppDetailComReqDto_1.getPlatformType(), "B1-2修改忘记密码-D1-2查询平台联盟应用配置的发送人成员ID-是否平台应用不能为空", false);
                queryAppDetailComRespDto_2 = fwBaseBaseClient.queryAppDetailCom(queryAppDetailComReqDto_1).getData()/*vcase invoke 跨dubbo调用;*/;
                Assert.isTrue(queryAppDetailComRespDto_2 == null || queryAppDetailComRespDto_2.getAppId() == null, "找不到数据，系统异常", false);


            }
            if ((queryAppDetailComRespDto_2 != null && queryAppDetailComRespDto_2.getSenderMemberId() != null)) {
                //if(D1-2查询平台联盟应用配置的发送人成员ID.配置消息发送人成员ID 值不等于空 )  41948

                QueryMemberProfileDetailComRespDto queryMemberProfileDetailComRespDto_2 = null;
                if (queryAppDetailComRespDto_2 != null) {
                    QueryMemberProfileDetailComReqDto queryMemberProfileDetailComReqDto_1 = new QueryMemberProfileDetailComReqDto();
                    if (queryAppDetailComRespDto_2 != null) {
                        queryMemberProfileDetailComReqDto_1.setOriginalRoleMemberId(queryAppDetailComRespDto_2.getSenderMemberId());//SimpleFieldAssign//sourceId:972406_1_41952
                        queryMemberProfileDetailComReqDto_1.setSpaceId(queryAppDetailComRespDto_2.getUniqueSpaceId());//SimpleFieldAssign//sourceId:1038856_1_41952
                    }

                    /*D1查询成员个人资料详情(公共)[6778]   */
                    Assert.isNull(queryMemberProfileDetailComReqDto_1.getSpaceId(), "B1-2修改忘记密码-D1查询成员个人资料详情(公共)-创建于空间ID不能为空", false);
                    queryMemberProfileDetailComRespDto_2 = fwBaseMemberClient.queryMemberProfileDetailCom(queryMemberProfileDetailComReqDto_1).getData()/*vcase invoke 跨dubbo调用;*/;


                }
                com.wicket.okrapp.integration.dto.ImplementPushCacheSendMessageChannelComRespDto implementPushCacheSendMessageChannelComRespDto_2 = null;
                if (queryMemberProfileDetailComRespDto_2 != null && queryAppDetailComRespDto_2 != null && findPasswordRespDto != null) {
                    com.wicket.okrapp.integration.dto.ImplementPushCacheSendMessageChannelComReqDto implementPushCacheSendMessageChannelComReqDto_1 = new com.wicket.okrapp.integration.dto.ImplementPushCacheSendMessageChannelComReqDto();
                    implementPushCacheSendMessageChannelComReqDto_1.setUseChannelMethod("ISHAVE_MEMBER_CHANNEL");//sourceId:1521414_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setMessageTemplateCode("FORGOT_PWD_RESET_NOTICE");//CUSTOM_CONVENTION//sourceId:1521415_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setMessageLocationTypeCode("INTELLIGENT_CUSTOMER_SERVICE");//CUSTOM_CONVENTION//sourceId:1521416_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setMessagePromptType("NUMBER_TYPE");//sourceId:1521417_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setPlatformReplace("FALSE");//sourceId:1521418_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setMsgChannelClassCode("INTELLIGENT_CUSTOMER_SERVICE");//sourceId:1521420_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setChannelTypeCode("MESSAGE_ASSISTANT");//sourceId:1521421_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setNewTableTypeCode("OMS_FRAMEWORK_ORIGINAL_ROLE_MEMBER");//sourceId:1521423_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setMessageImportantLevel(Long.valueOf(3));//CUSTOM_CONVENTION//sourceId:1521428_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setConTableTypeCode("OMS_FRAMEWORK_USERS");//sourceId:1521429_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setHandleType("NO_NEED_HANDLING");//sourceId:1521440_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setBorcScene("TOB_SCENE");//sourceId:1521443_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setMessageRole("assistant");//sourceId:1521444_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setIsAssistant("TRUE");//sourceId:1521445_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setComNumField(Long.valueOf(1));//CUSTOM_CONVENTION//sourceId:1521461_1_60630
                    implementPushCacheSendMessageChannelComReqDto_1.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1521462_1_60630
                    if (queryMemberProfileDetailComRespDto_2 != null) {
                        implementPushCacheSendMessageChannelComReqDto_1.setChannelLogo(queryMemberProfileDetailComRespDto_2.getUserFace());//SimpleFieldAssign//sourceId:1521419_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setChannelName(queryMemberProfileDetailComRespDto_2.getIdCardName());//SimpleFieldAssign//sourceId:1521422_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setChannelSpaceId(queryMemberProfileDetailComRespDto_2.getSpaceId());//SimpleFieldAssign//sourceId:1521426_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setChannelAppId(queryMemberProfileDetailComRespDto_2.getAppId());//SimpleFieldAssign//sourceId:1521427_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setSenderUserId(queryMemberProfileDetailComRespDto_2.getUserId());//SimpleFieldAssign//sourceId:1521450_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setSenderProfilePictureAddress(queryMemberProfileDetailComRespDto_2.getUserFace());//SimpleFieldAssign//sourceId:1521451_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setNameOfSender(queryMemberProfileDetailComRespDto_2.getIdCardName());//SimpleFieldAssign//sourceId:1521452_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setSenderSpaceId(queryMemberProfileDetailComRespDto_2.getSpaceId());//SimpleFieldAssign//sourceId:1521453_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setSenderAppId(queryMemberProfileDetailComRespDto_2.getAppId());//SimpleFieldAssign//sourceId:1521454_1_60630
                    }
                    if (queryAppDetailComRespDto_2 != null) {
                        implementPushCacheSendMessageChannelComReqDto_1.setNewEntityId(queryAppDetailComRespDto_2.getSenderMemberId());//SimpleFieldAssign//sourceId:1521424_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setSenderOriginalRoleMemberId(queryAppDetailComRespDto_2.getSenderMemberId());//SimpleFieldAssign//sourceId:1521449_1_60630
                    }
                    if (findPasswordRespDto != null) {
                        implementPushCacheSendMessageChannelComReqDto_1.setConEntityId(findPasswordRespDto.getUserId());//SimpleFieldAssign//sourceId:1521430_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setObjectName(findPasswordRespDto.getObjectName());//SimpleFieldAssign//sourceId:1521437_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setNewMessage(findPasswordRespDto.getObjectName());//SimpleFieldAssign//sourceId:1521438_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setReceiveOriginalRoleMemberId(findPasswordRespDto.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:1521455_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setReceiveUserId(findPasswordRespDto.getUserId());//SimpleFieldAssign//sourceId:1521456_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setReceiveProfilePictureAddress(findPasswordRespDto.getUserFace());//SimpleFieldAssign//sourceId:1521457_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setNameOfReceive(findPasswordRespDto.getIdCardName());//SimpleFieldAssign//sourceId:1521458_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setReceiveSpaceId(findPasswordRespDto.getSpaceId());//SimpleFieldAssign//sourceId:1521459_1_60630
                        implementPushCacheSendMessageChannelComReqDto_1.setReceiveAppId(findPasswordRespDto.getAppId());//SimpleFieldAssign//sourceId:1521460_1_60630
                    }

                    /*D3执行推缓存发送消息到通道(公共)[8428]   */
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getUseChannelMethod(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-使用通道方式不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getMessageTemplateCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息模板标识不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getMessageLocationTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息位置标识不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getMessagePromptType(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息提示类型不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getPlatformReplace(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-是否平台代操作不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getMsgChannelClassCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息使用通道类别不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getChannelTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道类型编码不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getChannelLogo(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道缩略图地址不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getChannelName(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道名称不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getNewTableTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属主体内容类型编码不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getNewEntityId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属主体内容ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getChannelSpaceId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属空间ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getChannelAppId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通道归属联盟应用ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getMessageImportantLevel(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-消息重要紧急度层级不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getConTableTypeCode(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-内容表编码不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getConEntityId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-内容表主键ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getObjectName(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-对象名称不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getNewMessage(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-最新消息文本不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getHandleType(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-处理类型不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getBorcScene(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-toB或toC场景不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getMessageRole(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方角色不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getIsAssistant(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方是否助手不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getSenderOriginalRoleMemberId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方身份人员ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getSenderUserId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方账号ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getSenderProfilePictureAddress(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方头像地址不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getNameOfSender(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方姓名不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getSenderSpaceId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方空间ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getSenderAppId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-发送方联盟应用ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getReceiveOriginalRoleMemberId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方身份人员ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getReceiveUserId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方账号ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getReceiveProfilePictureAddress(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方头像地址不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getNameOfReceive(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方姓名不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getReceiveSpaceId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方空间ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getReceiveAppId(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-接收方联盟应用ID不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getComNumField(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-通用数值字段（整数型）不能为空", false);
                    Assert.isNull(implementPushCacheSendMessageChannelComReqDto_1.getOperateTime(), "B1-2修改忘记密码-D3执行推缓存发送消息到通道(公共)-操作时间不能为空", false);
                    implementPushCacheSendMessageChannelComRespDto_2 = fwAppMessageClient.implementPushCacheSendMessageChannelCom(implementPushCacheSendMessageChannelComReqDto_1).getData()/*vcase invoke 跨dubbo调用;*/;


                    implementPushCacheSendMessageChannelComRespDto_1 = implementPushCacheSendMessageChannelComRespDto_2;
                }
            } else {
                //else  41949

//异常结束 41950
                throw new BizException("500", "系统异常，请联系管理员！", false);
            }
        }
        BffUpdateForgotPasswordRespDto retData = new BffUpdateForgotPasswordRespDto();
        if (implementPushCacheSendMessageChannelComRespDto_1 != null) {
            retData.setMessageId(implementPushCacheSendMessageChannelComRespDto_1.getMessageId());//SimpleFieldAssign//sourceId:1521467_1
        }


        return retData;
    }
    //
}
